﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraGrid.Views.Grid;

namespace QLTK
{
    public partial class frmDetailStore : Form
    {
        public frmDetailStore(DataRow vitri)
        {
            InitializeComponent();
            show(vitri);
        }

        private void show(DataRow vitri)
        {
            label1.Text = "Các tờ khai đang được lưu tại Hộp " + vitri["Hop"].ToString() + ", Tầng " + vitri["Tang"].ToString() + ", Kệ " + vitri["Ke"].ToString() + ":";
            int id = Convert.ToInt32(vitri["Id"].ToString());
            toKhaiTableAdapter.ToKhaiByKho(qLTKDataSet.ToKhai, id);
        }

        private void frmDetailStore_Load(object sender, EventArgs e)
        {
           

        }

        private void gridViewDetailStore_RowStyle(object sender, RowStyleEventArgs e)
        {
            var view = sender as GridView;
            if (e.RowHandle >= 0)
            {
                string status = view.GetRowCellDisplayText(e.RowHandle, view.Columns["TrangThai"]);
                if (status == "Đã sắp xếp")
                {
                    e.Appearance.BackColor = Color.PowderBlue;
                    e.Appearance.BackColor2 = Color.PowderBlue;
                }
                else if (status == "Đang cho mượn")
                {
                    e.Appearance.BackColor = Color.PeachPuff;
                    e.Appearance.BackColor2 = Color.PeachPuff;
                }
                else if (status == "Chưa bàn giao")
                {
                    e.Appearance.BackColor = Color.Empty;
                    e.Appearance.BackColor2 = Color.Empty;
                }
                else
                {
                    e.Appearance.BackColor = Color.Gainsboro;
                    e.Appearance.BackColor2 = Color.Gainsboro;
                }
            }
        }
        
    }
}
